package view.rules;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.*;

import ruletree.rule.Rule;

import net.miginfocom.swing.MigLayout;

public class PhraseStructurePanel extends JPanel{
	
	private JPanel firstPanel;
	private JPanel secondPanel;
	private JButton showStructButton;
	private JButton insertNewConstButton;
	private JButton insertNewGroupButton;
	private JRadioButton showNamesRButton;
	private JRadioButton showDetailsRButton;
	private JRadioButton showRuleRButton;
	private JRadioButton showCooRButton;
	private JLabel commentLabel;
	private JTextArea commentArea;
	SubmitPanel submitPanel;
	
	public PhraseStructurePanel(){
		this.setLayout(new MigLayout());
		
		initComponent();
		addComponent();
	}

	private void initComponent() {
		
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		
		firstPanel = new JPanel();
		firstPanel.setPreferredSize(new Dimension((int)screenSize.getWidth() - 200, (int)screenSize.getHeight() - 400));
		firstPanel.setBorder(BorderFactory.createTitledBorder(""));
		
		secondPanel = new JPanel();
		secondPanel.setLayout(new MigLayout());
		showStructButton = new JButton("Show Structure");
		insertNewConstButton = new JButton("Insert New Constituent into Rule");
		insertNewGroupButton = new JButton("Insert New Group into Rule");
		showNamesRButton = new JRadioButton("Show Names");
		showDetailsRButton = new JRadioButton("Show Details");
		showRuleRButton = new JRadioButton("Show Rule");
		showCooRButton = new JRadioButton("Show Recorded Cooccurrences");
		
		commentLabel = new JLabel("Comment:");
		commentArea = new JTextArea();
		commentArea.setMinimumSize(new Dimension((int)screenSize.getWidth() - 200, (int)screenSize.getHeight() - 600));
		
		submitPanel = new SubmitPanel();
		
	}

	private void addComponent() {
		
		addToFirstPanel();
		add(firstPanel, "wrap");
		addToSecondPanel();
		add(secondPanel, "wrap");
		add(commentLabel, "wrap");
		add(commentArea, "wrap");
		add(submitPanel);
		
	}
	
	private void addToFirstPanel(){
		
	}
	
	private void addToSecondPanel(){
		secondPanel.add(insertNewConstButton);
		secondPanel.add(showNamesRButton);
		secondPanel.add(showRuleRButton);
		secondPanel.add(showStructButton, "gapleft 30, wrap");
		secondPanel.add(insertNewGroupButton);
		secondPanel.add(showDetailsRButton);
		secondPanel.add(showCooRButton);
	}
	
}
